
% RED   = '#FF0000'
% GREEN = '#00A000'
% BLUE  = '#0000A0'
% BLACK = '#000000'

<table bgcolor=#C0C0C0 celllspacing=1 cellpadding=3>
<tr bgcolor=#FFFFFF>
    <th>代码</th>
    <th>名称</th>
    <th>涨幅</th>
    <th>现价</th>
    <th>涨跌</th>
    <th>昨收</th>
    <th>今开</th>
    <th>最高</th>
    <th>最低</th>
    <th>竞买</th>
    <th>竞卖</th>
    <th>成交量(手)</th>
    <th>成交额(万元)</th>
</tr>


%for info in sorted(stockinfo, key=lambda x: x['percent'], reverse=True):
%    value = info['curr']
%    if value == 0:
%        color = BLACK
%    else:
%        color = { -1 : GREEN,
%                   0 : BLACK,
%                   1 : RED
%                }[cmp(value, info['last'])]
%    end
%    percent = '%.2f%%' % info['percent']

<tr bgcolor=#FFFFFF>
    <td> <a href='/stock/{{info['code']}}'> {{info['code']  }} </a></td>
    <td> <font color='{{BLUE}}' > {{info['name']  }} </font></td>
    <td> <font color='{{color}}'> {{percent       }} </font></td>
    <td> <font color='{{color}}'> {{info['curr']  }} </font></td>
    <td> <font color='{{color}}'> {{info['delta'] }} </font></td>
    <td> <font color='{{color}}'> {{info['last']  }} </font></td>
    <td> <font color='{{color}}'> {{info['open']  }} </font></td>
    <td> <font color='{{color}}'> {{info['low']   }} </font></td>
    <td> <font color='{{color}}'> {{info['high']  }} </font></td>
    <td> <font color='{{color}}'> {{info['buy']   }} </font></td>
    <td> <font color='{{color}}'> {{info['sell']  }} </font></td>
    <td> <font color='{{color}}'> {{info['volumn']}} </font></td>
    <td> <font color='{{color}}'> {{info['amount']}} </font></td>
</tr>
% end
</table>
<p align='right'><a href='/index.php'>phpinfo</a></p>

